package com.zxx.pattern.factoryPattern.factoryDelete.simple;

/**
 * @author zxx on 2020/12/28
 */
public class PizzaTest {

    SimplePizzaFactory factory;

    public PizzaTest(SimplePizzaFactory factory) {
        this.factory = factory;
    }

    public Pizza orderPizza(String type) {
        Pizza pizza;

        //使用工厂对象的创建方法，而不是直接new。这里不再使用具体实例化
        pizza = factory.createPizza(type);

        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();
        return pizza;
    }

}


